package data;

/**
 * This class manages data, methods, and fields relevant to a User.
 * This is an abstract class, and therefore cannot be instantiated.
 * 
 * @author Stephen Amos
 */
public abstract class User{
	
	/**
	 * The username of this User.
	 */
	protected String username;
	
	/**
	 * The password of this User.
	 */
	protected String password;
	
	/**
	 * The phone number of this User.
	 */
	protected String phone;
	
	/**
	 * The e-mail address of this User.
	 */
	protected String email;
	
	/**
	 * Constructs a new User based upon the parameters passed in.
	 *
	 * @param username The username for this User object.
	 * @param password The password for this User object.
	 * @param phone The phone number for this User object.
	 * @param email The e-mail address for this User object.
	 */
	public User(String username, String password, String phone, String email) {
		this.email = email;
		this.username = username;
		this.phone = phone;
		this.password = password;
	}
	
	/**
	 * Logs a User into the System, or denies access if their credentials
	 * are incorrect.
	 * 
	 * @param username The username of the User logging in.
	 * @param password The password of the User logging in.
	 * @return Returns true if, and only if the User has successfully logged
	 * into the System.
	 */
	public boolean login(String username, String password) {
		return this.username == username && this.password == password;
	}
	
	//I need this to check for duplicate account

	
	// getters and setters

	/**
	 * Gets this User's username.
	 * 
	 * @return This user's username.
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * Sets this User's username based upon the parameter passed in.
	 * 
	 * @param username The username to be set.
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * Gets this User's password.
	 * 
	 * @return This User's password.
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * Sets this User's password based upon the parameter passed in.
	 * 
	 * @param password The poassword to be set.
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * Gets this User's phone number.
	 * 
	 * @return This User's phone number.
	 */
	public String getPhone() {
		return phone;
	}

	/**
	 * Sets this User's phone number basd upon the parameter passed in.
	 * 
	 * @param phone The phone number to be set.
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/**
	 * Gets this User's e-mail address.
	 * 
	 * @return This user's e-mail address.
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * Sets this User's e-mail address based upon the parameter passed in.
	 * 
	 * @param email The e-mail address to be set.
	 */
	public void setEmail(String email) {
		this.email = email;
	}
	
	/**
	 * This over-ridden toString() method returns a String containing all of
	 * a User object's fields.
	 * 
	 * @return A string containing all of a User object's fields.
	 */
	public String toString() {
		return username + ",," + password + ",," + phone + ",," + email + "\n";
	}
	
}
